<?php

namespace App\Models\Admin;

use App\Models\Model;

class AdminRoute extends Model
{
    protected $table = 'admin_route';
    protected $primaryKey = 'route_id';

    //fillable 属性指定哪些属性可以被集体赋值;Guarded则相反
    protected $guarded = [];

    public function roles()
    {
        return $this->belongsToMany('App\Models\Admin\AdminRole','admin_route_role','route_id', 'role_id')
            ->using('App\Models\Admin\AdminRouteRole');
    }

    public function powers()
    {
        return $this->belongsToMany('App\Models\Admin\AdminPower','admin_power_route','route_id', 'power_id')
            ->using('App\Models\Admin\AdminPowerRoute');
    }


}
